<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<?php $this->load->view('common/head');?>
<body class="no-skin">
<?php $this->load->view('common/header');?>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <?php $this->load->view('common/sidebar');?>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <?php $this->load->view('common/breadcrumbs');?>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">

                <?php $this->load->view('common/set');?>

                <!-- /section:settings.box -->
                <div class="row">
                    <?php if(isset($user) && $user['user_group']!=4){?>
                    <form class="form-inline" action="" method="get">

                        <label class="inline">项目名称</label>
                        <input type="text" name="user_name" value="" class="form-control" id="paoject_name">
                        <button type="submit" class="btn btn-info btn-sm" id="submit">
                            <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                            查询
                        </button>
                        <span class="btn btn-warning btn-sm" id="adduser">
                            <span class="ace-icon fa fa-user icon-on-right bigger-110"></span>
                            新增项目
                        </span>
                    </form>
                    <?php }?>
                    <div class="col-xs-12">

                        </div>
                        <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th class="center">项目ID</th>
                                <th class="center">项目名称</th>
                                <th class="center">状态</th>
                                <th class="center">标签</th>
                                <th class="center">类型</th>
                                <th class="center">参与人员</th>
                                <th class="center">开始时间</th>
                                <th class="center">交付时间</th>
                                <th class="center">客户名称</th>
                                <th class="center">联系电话</th>
                                <th class="center">总价格</th>
                                <th class="center">已收款</th>
                                <th class="center">派发价</th>
                                <th class="center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if(isset($projects)){ foreach ($projects as $key => $val) { ?>
                                <tr>
                                    <td class="center"><?php echo $val['project_id']; ?></td>
                                    <td class="center"><?php echo $val['project_name']; ?></td>
                                    <td class="center">
                                        <?php if($val['project_status']==0) echo '未开始' ?>
                                        <?php if($val['project_status']==1) echo '制作中' ?>
                                        <?php if($val['project_status']==2) echo '测试中' ?>
                                        <?php if($val['project_status']==3) echo '已完成' ?>
                                    </td>
                                    <td class="center"><?php  foreach ($val['project_tags'] as $k=>$v){echo $v.' ';}; ?></td>
                                    <td class="center"><?php  foreach ($val['project_types'] as $k=>$v){echo $v.' ';}; ?></td>
                                    <td class="center"><?php  foreach ($val['project_uses'] as $k=>$v){?>
                                            <?php echo $v; ?>
                                    <?php }?>
                                    <td class="center"><?php echo $val['project_start_time']; ?></td>
                                    <td class="center"><?php echo $val['project_end_time']; ?></td>
                                    <td class="center"><?php echo $val['project_customer']; ?></td>
                                    <td class="center"><?php echo $val['project_customer_tel']; ?></td>
                                    <td class="center"><?php echo $val['project_total_money']; ?></td>
                                    <td class="center"><?php echo $val['project_get_money']; ?></td>
                                    <td class="center"><?php echo $val['project_money']; ?></td>
                                    <?php if(isset($user) && $user['user_group']!=4){?>
                                        <?php if($val['project_status']!=3){?>
                                        <td class="center">
                                            <a class="green" href="<?php echo site_url(X_URL.'project/edit/'.$val['project_id']);?>" title="修改"><i class="ace-icon fa fa-pencil bigger-130"></i></a>&nbsp;
                                            <a class="del red" href="javascript:;" val="<?php echo site_url(X_URL.'project/delete/'.$val['project_id']);?>" title="删除"><i class="ace-icon fa fa-trash bigger-130"></i></a>
                                        </td>
                                        <?php }else{ ?>
                                            <td class="center"><span class="label label-sm label-success">已完成</span></td>
                                        <?php }?>
                                    <?php }else{?>
                                        <td class="center">--</td>
                                    <?php }?>

                                </tr>
                            <?php } }?>
                            </tbody>
                        </table>
                        <?php if(isset($pagination)){?><ul class="pagination"><?php echo $pagination;?></ul><?php }?>
<!--                        {$page}-->
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
    </div><!-- /.main-content -->

<?php $this->load->view('common/footer');?>
</div><!-- /.main-container -->

<?php $this->load->view('common/footerjs');?>
<?php echo admin_js_url('laydate');?>
<!-- inline scripts related to this page -->
<script type="text/javascript">

    $(function () {
        $("#officialnews ul").html('<div class="ace-icon fa fa-spinner fa-spin orange"></div>');
    })
    $("#adduser").click(function () {
        window.location.href="add";
    });

    $(".del").click(function () {
        var url = $(this).attr('val');
        bootbox.confirm({
            title: "系统提示",
            message: "确定要删除?",
            callback: function (result) {
                if (result) {
                    window.location.href = url;
                }
            },
            buttons: {
                "cancel": {"label": "取消"},
                "confirm": {
                    "label": "确定",
                    "className": "btn-danger"
                }
            }
        });
    });

</script>
</body>
</html>
